﻿using System;
using System.Data;

namespace DAL
{
    public static class DalApplicants
    {
        private static readonly clsConnect Cls = new clsConnect();
        #region[Get-Data]
        public static DataTable GetApplicants(string keywords)
        {
            Cls.CreateNewSqlCommand();
            Cls.AddParameter("@KEYWORDS", keywords);
            return Cls.GetData("sp_Applicants_Get");
        }
        public static DataTable GetApplicantsEdit(int id)
        {
            Cls.CreateNewSqlCommand();
            Cls.AddParameter("@Applicants_ID", id);
            return Cls.GetData("sp_Applicants_Get_Edit");
        }
        #endregion

        #region[Insert-Update-Delete]
        public static bool Insert(EtApplicants obj)
        {
            Cls.CreateNewSqlCommand();
            Cls.AddParameter("@ID_Main", obj.ID_Main);
            Cls.AddParameter("@Level_ID", obj.Level_ID);
            Cls.AddParameter("@Job_ID", obj.Job_ID);
            Cls.AddParameter("@Applicants_No", obj.Applicants_No);
            Cls.AddParameter("@Applicants_Name", obj.Applicants_Name);
            Cls.AddParameter("@Applicants_Identification", obj.Applicants_Identification);
            Cls.AddParameter("@Applicants_PlaceOfIssue", obj.Applicants_PlaceOfIssue);
            Cls.AddParameter("@Applicants_BirthDay", obj.Applicants_BirthDay);
            Cls.AddParameter("@Applicants_Gender", obj.Applicants_Gender);
            Cls.AddParameter("@Ethnic_ID", obj.Ethnic_ID);
            Cls.AddParameter("@Religion_ID", obj.Religion_ID);
            Cls.AddParameter("@Applicants_Address", obj.Applicants_Address);
            Cls.AddParameter("@Districts_ID", obj.Districts_ID);
            Cls.AddParameter("@Applicants_Address_Staying", obj.Applicants_Address_Staying);
            Cls.AddParameter("@Districts_ID_Staying", obj.Districts_ID_Staying);
            Cls.AddParameter("@Applicants_Email", obj.Applicants_Email);
            Cls.AddParameter("@Applicants_Phone", obj.Applicants_Phone);
            Cls.AddParameter("@Applicants_Mobie", obj.Applicants_Mobie);
            Cls.AddParameter("@Educational_Level_ID", obj.Educational_Level_ID);
            Cls.AddParameter("@Sector_ID", obj.Sector_ID);
            Cls.AddParameter("@Applicants_Language_Level", obj.Applicants_Language_Level);
            Cls.AddParameter("@Applicants_Informatics", obj.Applicants_Informatics);
            Cls.AddParameter("@Applicants_YearsOfExperience", obj.Applicants_YearsOfExperience);
            Cls.AddParameter("@Applicants_Wage_Current", obj.Applicants_Wage_Current);
            Cls.AddParameter("@Applicants_Wage_Order", obj.Applicants_Wage_Order);
            Cls.AddParameter("@Applicants_Skills", obj.Applicants_Skills);
            Cls.AddParameter("@Applicants_Experience", obj.Applicants_Experience);
            Cls.AddParameter("@Applicants_Objectives", obj.Applicants_Objectives);
            Cls.AddParameter("@Applicants_Introduce", obj.Applicants_Introduce);
            Cls.AddParameter("@Applicants_Notes", obj.Applicants_Notes);
            return Cls.ExecuteNonQuery("sp_Applicants_Insert");
        }
        public static bool Update(EtApplicants obj)
        {
            Cls.CreateNewSqlCommand();
            Cls.AddParameter("@Applicants_ID", obj.Applicants_ID);
            Cls.AddParameter("@ID_Main", obj.ID_Main);
            Cls.AddParameter("@Level_ID", obj.Level_ID);
            Cls.AddParameter("@Job_ID", obj.Job_ID);
            Cls.AddParameter("@Applicants_No", obj.Applicants_No);
            Cls.AddParameter("@Applicants_Name", obj.Applicants_Name);
            Cls.AddParameter("@Applicants_Identification", obj.Applicants_Identification);
            Cls.AddParameter("@Applicants_PlaceOfIssue", obj.Applicants_PlaceOfIssue);
            Cls.AddParameter("@Applicants_BirthDay", obj.Applicants_BirthDay);
            Cls.AddParameter("@Applicants_Gender", obj.Applicants_Gender);
            Cls.AddParameter("@Ethnic_ID", obj.Ethnic_ID);
            Cls.AddParameter("@Religion_ID", obj.Religion_ID);
            Cls.AddParameter("@Applicants_Address", obj.Applicants_Address);
            Cls.AddParameter("@Districts_ID", obj.Districts_ID);
            Cls.AddParameter("@Applicants_Address_Staying", obj.Applicants_Address_Staying);
            Cls.AddParameter("@Districts_ID_Staying", obj.Districts_ID_Staying);
            Cls.AddParameter("@Applicants_Email", obj.Applicants_Email);
            Cls.AddParameter("@Applicants_Phone", obj.Applicants_Phone);
            Cls.AddParameter("@Applicants_Mobie", obj.Applicants_Mobie);
            Cls.AddParameter("@Educational_Level_ID", obj.Educational_Level_ID);
            Cls.AddParameter("@Sector_ID", obj.Sector_ID);
            Cls.AddParameter("@Applicants_Language_Level", obj.Applicants_Language_Level);
            Cls.AddParameter("@Applicants_Informatics", obj.Applicants_Informatics);
            Cls.AddParameter("@Applicants_YearsOfExperience", obj.Applicants_YearsOfExperience);
            Cls.AddParameter("@Applicants_Wage_Current", obj.Applicants_Wage_Current);
            Cls.AddParameter("@Applicants_Wage_Order", obj.Applicants_Wage_Order);
            Cls.AddParameter("@Applicants_Skills", obj.Applicants_Skills);
            Cls.AddParameter("@Applicants_Experience", obj.Applicants_Experience);
            Cls.AddParameter("@Applicants_Objectives", obj.Applicants_Objectives);
            Cls.AddParameter("@Applicants_Introduce", obj.Applicants_Introduce);
            Cls.AddParameter("@Applicants_Notes", obj.Applicants_Notes);
            return Cls.ExecuteNonQuery("sp_Applicants_Update");
        }
        public static bool Delete(EtApplicants obj)
        {
            Cls.CreateNewSqlCommand();
            Cls.AddParameter("@Applicants_ID", obj.Applicants_ID);
            return Cls.ExecuteNonQuery("sp_Applicants_Delete");
        }
        #endregion
    }

    public class EtApplicants
    {
        public int Applicants_ID { get; set; }
        public int ? ID_Main { get; set; }
        public int ? Level_ID { get; set; }
        public int ? Job_ID { get; set; }
        public string Applicants_No { get; set; }
        public string Applicants_Name { get; set; }
        public string Applicants_Identification { get; set; }
        public string Applicants_PlaceOfIssue { get; set; }
        public DateTime Applicants_BirthDay { get; set; }
        public string Applicants_Gender { get; set; }
        public int ? Ethnic_ID { get; set; }
        public int ? Religion_ID { get; set; }
        public string Applicants_Address { get; set; }
        public int ? Districts_ID { get; set; }
        public int ? Province_ID { get; set; }
        public string Applicants_Address_Staying { get; set; }
        public int ? Districts_ID_Staying { get; set; }
        public int ? Province_ID_Staying { get; set; }
        public string Applicants_Email { get; set; }
        public string Applicants_Phone { get; set; }
        public string Applicants_Mobie { get; set; }
        public int ? Educational_Level_ID { get; set; }
        public int ? Sector_ID { get; set; }
        public string Applicants_Language_Level { get; set; }
        public string Applicants_Informatics { get; set; }
        public int ? Applicants_YearsOfExperience { get; set; }
        public float ? Applicants_Wage_Current { get; set; }
        public float ? Applicants_Wage_Order { get; set; }
        public string Applicants_Skills { get; set; }
        public string Applicants_Experience { get; set; }
        public string Applicants_Objectives { get; set; }
        public string Applicants_Introduce { get; set; }
        public string Applicants_Notes { get; set; }
    }
}